<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./customer_promise.js" ></script>
</head>
<body>
  <div></div>
  <script type="text/javascript">
    let p = new Promise((resolve, reject)=>{
      //resolve('ok')
      //reject('error!')
      // throw 'error'

      setTimeout(()=>{
        resolve('ok')
      }, 1000)
    })
    console.log(p)

    p.then(value=>{
      console.log(value)
    }, reason=>{
       console.warn(reason)
    })

// 正常版本,状态修改后都会执行
    p.then(value=>{
      alert(value)
    }, reason=>{
      alert(reason)
    })

  </script>
</body>
</html>